use "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Publications Old\Paper Schaffer\mex endog figure.dta" , clear

gen xarrow10s = 558.4
gen yarrow10s = 1.4
gen xarrow10e = 557.9
gen yarrow10e = 1.4

gen xarrow1s = 560.1
gen yarrow1s = 1.4
gen xarrow1e = 559.6
gen yarrow1e = 1.4

gen xarrow10s2 = 558.4
gen yarrow10s2 = 1.47
gen xarrow10e2 = 557.9
gen yarrow10e2 = 1.47

gen xarrow1s2 = 560.1
gen yarrow1s2 = 1.47
gen xarrow1e2 = 559.6
gen yarrow1e2 = 1.47

*Panel A
twoway (scatter partisan_no_client var16, mcolor(gs12) msize(med) msym(S) mcolor(black) connect(l) lwidth(medthick) lcolor(black) xaxis(1) yaxis(1)) ///
(rcap partisan_no_client_lower_CI partisan_no_client_upper_CI var16, lcolor(black) lwidth(medthick) xaxis(1) yaxis(1)) ///
(rcap  partisan_client_lower_CI partisan_client_upper_CI date, lcolor(black) lwidth(medthick) xaxis(1) yaxis(1)) ///
(scatter partisan_client date, mcolor(black) msize(med) lcolor(black) connect(l) lwidth(medthick) xaxis(1) yaxis(1)) ///
(pcarrow yarrow10s xarrow10s yarrow10e xarrow10e, lcolor(black) mcolor(black)) /// 
(pcarrow yarrow1e xarrow1e yarrow1s xarrow1s , lcolor(black) mcolor(black)), ///
ytitle("{bf:Strength of Partisanship}", axis(1) size(med)) yscale(range(.75 1.4) lcolor(black) lwidth(medium) axis(1)) ///
xscale(range(550 561) lcolor(black) lwidth(medium))  ylab(.75 1 1.25, labsize(medsmall)) xtitle("{bf:Month, Year and Panel Wave}", size(med)) ///
xlab(552 "2005" 557 "2006", labsize(medsmall) notick labgap(8)) xmlab(551 `" "Oct" "[{it:pc}]" "'  552 "Nov" 553 "Dec" 554 "Jan" 555 "Feb" 556 "Mar" 557 "Apr" 558 `" "May" "[{it:c}]" "'  559 "June" 560 `" "July" "[{it:e}]" "', axis(1) labsize(medsmall)) ///
xtick(551(1)560, axis(1)) graphregion(color(white) margin(medlarge)) plotregion(lstyle(yxline) lcolor(black)) text(1.36 559.01 "Payoffs" "made to" "targets", size(medsmall)) legend(order(4 "Targets" 1 "Non-targets")  size(medsmall) rows(1) symxsize(8)) 
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Chapter 7 Clientelism\Figures\Chapter 7 Panel A.tif", as(tif) replace
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Publishers\Final Manuscript\Final Figures\BAR7_5A.tif", as(tif) replace width(1500)
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Publishers\Final Manuscript\Final Figures\BAR7_5A.pdf", as(pdf) replace 

*Panel B
twoway (rcap non_family_disc_no_lower_CI non_family_disc_no_upper_CI var16, lcolor(black) lwidth(medthick) xaxis(1) yaxis(1))  ///
(rcap  non_family_disc_lower_CI non_family_disc_upper_CI date, lcolor(black) lwidth(medthick) xaxis(1) yaxis(1))  ///
(scatter non_family_discussants_no_client var16, mcolor(gs12) msize(med) connect(l) lwidth(medthick) lcolor(black) msym(S) mcolor(black) xaxis(1) yaxis(1)) ///
 (scatter non_family_discussants_client date, mcolor(black) msize(med) lcolor(black) connect(l) lwidth(medthick) xaxis(1) yaxis(1)) ///
(pcarrow yarrow10s2 xarrow10s2 yarrow10e2 xarrow10e2, lcolor(black) mcolor(black)) /// 
(pcarrow yarrow1e2 xarrow1e2 yarrow1s2 xarrow1s2 , lcolor(black) mcolor(black)), ///
ytitle("{bf:Number of Nonfamilial Discussants}", axis(1) size(med)) yscale(range(.75 1.48) lcolor(black) lwidth(medium) axis(1)) ///
xscale(range(550 561) lcolor(black) lwidth(medium))  ylab(.75 1 1.25, labsize(medsmall)) xtitle("{bf:Month, Year and Panel Wave}", size(med)) ///
xlab(552 "2005" 557 "2006", labsize(medsmall) notick labgap(8)) xmlab(551 `" "Oct" "[{it:pc}]" "'  552 "Nov" 553 "Dec" 554 "Jan" 555 "Feb" 556 "Mar" 557 "Apr" 558 `" "May" "[{it:c}]" "'  559 "June" 560 `" "July" "[{it:e}]" "', axis(1) labsize(medsmall)) ///
xtick(551(1)560, axis(1)) graphregion(color(white) margin(medlarge)) plotregion(lstyle(yxline) lcolor(black)) text(1.42 559.01 "Payoffs" "made to" "targets", size(medsmall)) legend(order(4 "Targets" 3 "Non-targets")  size(medsmall) rows(1) symxsize(8)) 

graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Chapter 7 Clientelism\Figures\Chapter 7 Panel B.tif", as(tif) replace
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Publishers\Final Manuscript\Final Figures\BAR7_5B.tif", as(tif) replace width(1500)
graph export "C:\Users\Andy baker\OneDrive - UCB-O365\My Documents\Research\Paper Book Networks\Publishers\Final Manuscript\Final Figures\BAR7_5B.pdf", as(pdf) replace 
xyz
/*twoway (rcap non_family_disc_no_lower_CI non_family_disc_no_upper_CI date3, lcolor(gs12) lwidth(thick) xaxis(1) yaxis(1)) ///
(rcap  non_family_disc_lower_CI non_family_disc_upper_CI date3, lcolor(black) lwidth(medthick) xaxis(1) yaxis(1)) ///
(scatter non_family_discussants_no_client date3, mcolor(gs12) msize(med) connect(l) lwidth(medthick) lcolor(gs12) xaxis(1) yaxis(1)) ///
 (scatter non_family_discussants_client date3, mcolor(black) msize(med) lcolor(black) connect(l) xaxis(1) yaxis(1)), ///
 ytitle("{bf:Number of Non-familial Discussants}", axis(1)) yscale(range(.5 1.5) lcolor(black) lwidth(medium) axis(1)) ///
 xscale(range(550 561) lcolor(black) lwidth(medium))  ylab(.5 1 1.5) xtitle("{bf:Month, Year and Panel Wave}") ///
 xlab(552 "2005" 557 "2006", labsize(small) notick labgap(4)) xmlab(551 `" "Oct" "(pc wave)" "'  552 "Nov" 553 "Dec" 554 "Jan" 555 "Feb" 556 "Mar" 557 "Apr" 558 `" "May" "(c wave)" "'  559 "June" 560 `" "July" "(e wave)" "', axis(1)) ///
 xtick(551(1)560, axis(1)) graphregion(color(white) margin(medlarge)) plotregion(lstyle(yxline) lcolor(black)) text(.57 559 "Payoffs" "made to" "clients", size(small)) legend(order(4 "Clients" 3 "Non-clients")  size(small) rows(1) symxsize(8) )

